#ifndef STRUCT_ELEM_H_
#define STRUCT_ELEM_H_

#include "boost/multi_array.hpp"

namespace boost {
namespace gil {
namespace extension {
namespace filters {
namespace morph {
namespace struct_elem {

template<int X_EXTENT, int Y_EXTENT>
class struct_elem_t {
public:
    typedef int value_t;
    typedef boost::const_multi_array_ref<value_t, 2> values_array_t;
    typedef struct {
        int x;
        int y;
    } origin_t;

    struct_elem_t(const origin_t origin,
            const value_t values[Y_EXTENT][X_EXTENT]);
    virtual ~struct_elem_t();

    const origin_t get_origin() const;
    const values_array_t& get_values() const;

private:
    const origin_t origin;
    const values_array_t values;
};

template<int X_EXTENT, int Y_EXTENT>
struct_elem_t<X_EXTENT, Y_EXTENT>::struct_elem_t(const origin_t origin,
        const value_t values[Y_EXTENT][X_EXTENT]) :
    origin(origin),
    values((struct_elem_t<X_EXTENT, Y_EXTENT>::value_t*) values,
            boost::extents[Y_EXTENT][X_EXTENT]) {

}

template<int X_EXTENT, int Y_EXTENT>
struct_elem_t<X_EXTENT, Y_EXTENT>::~struct_elem_t() {

}

template<int X_EXTENT, int Y_EXTENT>
const typename struct_elem_t<X_EXTENT, Y_EXTENT>::origin_t struct_elem_t<
        X_EXTENT, Y_EXTENT>::get_origin() const {
    return origin;
}

template<int X_EXTENT, int Y_EXTENT>
const typename struct_elem_t<X_EXTENT, Y_EXTENT>::values_array_t& struct_elem_t<
        X_EXTENT, Y_EXTENT>::get_values() const {
    return values;
}

}
}
}
}
}
}

#endif /* STRUCT_ELEM_H_ */
